#include "../../LIB/prpsock/prpsock.h"
#include "dbwrappers.h"
#include "userinfo.h"
#include "hash.h"

class LightLoginManager : public BAM::cLoginManager

{
private:
	char *username;
	char *password;
	int id;

public:
	LightLoginManager(char *_username, char *_password):
	  username(_username),
	  password(_password)
	{
		id = dehash2(password);
	}

    BAM::cPacket getPassword(const BAM::cPacket &login)
    {
		BAM::cPacket p = login;
		
		p.insertTail((const BAM::byte*)"", 1);
		if(0 != strcmp(username, (char*)p.getData()))
		{
			throw BAM::EXC_Login;
		}
		
		return BAM::cPacket((BAM::byte*)password, strlen(password));

	}

	int GetId()
	{
		return id;
	}




};